package org.daochong.lang;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

public abstract class DefaultEventListener<T> implements EventListener<T> {
	private Class<T> clazz = null;
	private String operation;

	public String getOperation() {
		return operation;
	}

	public void setOperation(String operation) {
		this.operation = operation;
	}

	@SuppressWarnings("unchecked")
	public DefaultEventListener() {
		Type genType = this.getClass().getGenericSuperclass();
		Type[] params = ((ParameterizedType) genType).getActualTypeArguments();
		this.clazz = (Class<T>) params[0];
	}

	public Class<T> getListenerClass() {
		return this.clazz;
	}

}
